#!/bin/bash

black="\033[30m" #黑
red="\033[31m" #红
green="\033[32m" #绿
yellow="\033[33m" #黄
blue="\033[34m" #蓝
white="\033[37m" #白

echo -e "${black}\n初始化开始\n"
echo -e "${blue}$(uname -a)\n"

# 定义白名单模式
baimingdan="Android|DCIM|Download|MT2|手机清理\.sh"
# 定义黑名单模式为数组，存储多个路径
heimingdan=(
    "/storage/emulated/0/Android/data/com.netease.cloudmusic/files/Cache" #网易云音乐缓存
    "/storage/emulated/0/Android/data/com.tencent.mobileqq/Tencent/QQfile_recv" #QQ下载文件
)

liebiao=$(ls -a | grep -Ev "^(${baimingdan})")
echo -e "${green}开始白名单模式清理\n${white}"
for item in $liebiao; do
echo -e "${red}rm -rf ${white}$item${red}"
if rm -rf $item &>/dev/null; then
echo -e "${green}成功删除${white}"
else
echo -e "${red}删除失败: 请检查路径或权限${white}"
fi
done
echo -e "${yellow} 白名单模式执行完成\n${white}"
echo -e "${green}开始黑名单模式清理\n${white}"
for item in "${heimingdan[@]}"; do
echo -e "${red}rm -rf ${white}$item${red}"
if rm -rf $item &>/dev/null; then
echo -e "${green}成功删除${white}"
else
echo -e "${red}删除失败: 请检查路径或权限${white}"
fi
done
echo -e "${yellow} 黑名单模式执行完成\n${white}"
exit